package com.lanou3g.code0410;

/**
 * Created by dllo on 18/4/10.
 */
//多态
public class Test02 {
    public static void main(String[] args) {
        /*
        父类引用指向子类对象
        ----------多态
        有继承就会有多态
        */
        Animal animal = new Animal();
        Animal animal1= new Cat();




        Animal animal2= new Dog();
        Dog dog =(Dog)animal2;//向下转型
        Zoo zoo= new Zoo();
        zoo.feed(animal);
        zoo.feed(animal1);
        zoo.feed(animal2);

    }
}
